/*
 * BenchmarkDailyDumpCheckJob
 * Created: Dec 19, 2006 
 * by abargnesi<mailto:abargnesi@aquent.com/>
 */
package com.den4.jynform.tasks;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.den4.jynform.alerts.EmailLogger;

public class FileBackupJob implements Job {
    private EmailLogger emailLogger;
    private String taskMsg;
    private String taskSubject;
    private Log log = LogFactory.getLog(FileBackupJob.class);
    private String backupName;
    private String backupFolder;
    private String backupDestination;
    private SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy_HH-mm-ss");

    public void execute(JobExecutionContext ctx) throws JobExecutionException {
        Map jobMap = ctx.getJobDetail().getJobDataMap();
        emailLogger = (EmailLogger) jobMap.get("emailLogger");

        taskSubject = "FolderBackupJob - " + backupName;
        
        //Construct backup filename for current time.
        Date now = Calendar.getInstance().getTime();
        String backupFile = backupName.concat("_").concat(df.format(now));
        
        //Zip contents of "backupFolder" folder.
        
        //Save Zip to "backupDestination" folder.
        
        //Email message and optionally email zipped attachment.
    }
}
